package datalayer;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import Lijsten.ReptielLijst;
import model.Aap;
import model.Dier;
import model.Komodoveraan;
import model.Tijger;

public class ReptielLayer extends Datalayer{
	private int komodovoraanteller;
	
	public ArrayList<Dier> LoadAllReptils(){
		openConn();
		
		String load = "SELECT soort FROM animals.animals where animal_type = 2";
		
		ArrayList<Dier> reptielen = new ArrayList<>();
		
		try {
			stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(load);
			
			while(rs.next()){
				if(rs.getString("soort").equals("Komodoveraan")){
					if(komodovoraanteller >= 1){
						
					}
					else{
						ReptielLijst.getInstance().addReptils(new Komodoveraan());
						komodovoraanteller++;
					}
				}
			}

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		closeConn();
		return reptielen;
	}

}
